package com.niit.mobileDevide.Gender;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class GenderReducer extends Reducer<Text, Text, Text, IntWritable> {

    @Override
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        int count = 0;

        for (Text val : values) {
            count++;
        }

        // 输出结果，键保持不变，值为计数值
        context.write(key, new IntWritable(count));
    }
}